import SocketIO from 'socket.io-client'
import store from "@/store";
class Socket {
    
    constructor (){
        const socket = SocketIO();
        console.log(store.getters['account/user'])
        const user = store.getters['account/user']
        socket.emit('login',{user})
        socket.on('serverMessage', data => {
            console.log(data)
        })
        this.socket = socket
    }
    emit(type, data){
        this.socket.emit(type,data)
    }
}
const socket = new Socket()
console.log(socket)
export default socket